home *** CD-ROM | disk | FTP | other *** search
- Path: EU.net!sun4nl!xs4all!falstaff
- From: falstaff@xs4all.nl (Falstaff)
- Newsgroups: comp.lang.c
- Subject: Re: Macros in C (Disadvantages?)
- Date: 9 Jan 1996 23:04:45 GMT
- Organization: XS4ALL, networking for the masses
- Message-ID: <4cusad$1db@news.xs4all.nl>
- References: <4cjluh$gva@kernighan.cs.umass.edu> <821173834.5944@paget.demon.co.uk> <4cthcp$1c0@yarrow.wt.com.au>
- NNTP-Posting-Host: xs1.xs4all.nl
- X-Newsreader: NN version 6.5.0 #666 (NOV)
-
- bvarley@yarrow.wt.com.au (bruce varley) writes:
-
- >Here is an a example that illustrates the danger(s) of macros.....
-
- >#define A 7
- >#define B 4+5
-
- >C = A * B. This will produce 33.
-
- And there is always the difficulty with
-
- #define A 1
- .
- . some code
- .
- #define A A+1
- .
- . more code
- .
- #define A A+1
-
- that is partly solved in ANSI C by enumerate types; and the fact that
- macros can't define other macros.
-
- Frank
- --
- "Life without a backbone is hardly worth consideration."
- ------------------------------------------------------------------------
- Frank A. Vorstenbosch +31-(70)-355 5241 falstaff@xs4all.nl
-